package cn.ronghuanet;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 定义一个文档对象
 */
@Document(indexName = "car_test",type = "userDoc")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDoc {

    @Id
    private Long id;

    @Field(type = FieldType.Keyword)
    private String username;

    @Field(type = FieldType.Integer)
    private Integer age;

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String intro;

    public UserDoc(Long id, String username) {
        this.id = id;
        this.username = username;
    }
}
